package io.renren.modules.groupunnormal.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import io.renren.modules.poschangerecord.entity.PreposEntity;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import io.renren.modules.groupunnormal.entity.GroupunnormalEntity;
import io.renren.modules.groupunnormal.service.GroupunnormalService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2022-12-21 11:00:51
 */
@RestController
@RequestMapping("groupunnormal/groupunnormal")
public class GroupunnormalController {
    @Autowired
    private GroupunnormalService groupunnormalService;


    @GetMapping("getshuju")
    public List<GroupunnormalEntity> getshuju(@RequestParam(value = "key",required = false) String wName,@RequestParam(value = "startTime",required = false) String startTime,@RequestParam(value = "endTime",required = false) String endTime){
        return groupunnormalService.getshuju(wName,startTime,endTime);
    }


    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("groupunnormal:groupunnormal:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = groupunnormalService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{groupid}")
    @RequiresPermissions("groupunnormal:groupunnormal:info")
    public R info(@PathVariable("groupid") Integer groupid){
		GroupunnormalEntity groupunnormal = groupunnormalService.getById(groupid);

        return R.ok().put("groupunnormal", groupunnormal);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("groupunnormal:groupunnormal:save")
    public R save(@RequestBody GroupunnormalEntity groupunnormal){
		groupunnormalService.save(groupunnormal);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("groupunnormal:groupunnormal:update")
    public R update(@RequestBody GroupunnormalEntity groupunnormal){
		groupunnormalService.updateById(groupunnormal);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("groupunnormal:groupunnormal:delete")
    public R delete(@RequestBody Integer[] groupids){
		groupunnormalService.removeByIds(Arrays.asList(groupids));

        return R.ok();
    }

}
